/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.entity.Book;
import com.qdu.service.BookService;
import com.qdu.service.impl.BookServiceImpl;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * @author Lenovo
 */
@WebServlet("/sboks")
public class SearchBokServlet extends HttpServlet{
    
    BookService bookServiceImpl = new BookServiceImpl(); 

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
   
        String keyword2 = req.getParameter("keyword2");
        System.out.println("servlet收到的关键字是："+keyword2);
        List<Book> list=bookServiceImpl.findBooksByKeyword(keyword2);
        req.setAttribute("boklist", list);
        req.getRequestDispatcher("/searchboklist.jsp").forward(req, resp);
    }

}

